@page "/presentation/smartart"
@inject Microsoft.JSInterop.IJSRuntime JS
@using System.IO
@using Syncfusion.Blazor.Buttons

@using BlazorDemos.Data.FileFormats.Presentation
@inherits SampleBaseComponent;

<SampleDescription>
 <p style="font-size:16px">This sample demonstrates how to create SmartArt diagram in a PowerPoint presentation.</p>   
</SampleDescription>
<ActionDescription>
  <b style="font-size:16px">Features:</b>
    <br />
    <ul style="font-size:16px">
			<li>Create and edit 134 default SmartArt diagram equivalent to Microsoft PowerPoint.</li>
            <li>Add, modify and remove nodes of the SmartArt diagram.</li>
    </ul>
    <br /> 
</ActionDescription>

<div class="control-section">
    <p style="font-size:16px">Click the button to view a PowerPoint presentation generated by Essential Presentation. Please note that Microsoft PowerPoint viewer or its equivalent is required to view the resultant document.</p>
        
    <div class="button-section">
        <div id="button-control">
            <div class="row">
                <div>
                    <SfButton @onclick="CreateSmartArt">Create Presentation</SfButton>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
    .control-section .row {
        margin: 10px 0;
    }
</style>

@code {
    MemoryStream documentStream;    

    /// <summary>
    /// Create and download the Presentation document
    /// </summary>
    public async Task CreateSmartArt(MouseEventArgs args)
    {
        SmartArtService service = new SmartArtService();
        documentStream = service.CreateSmartArtPresentation();
        await JS.SaveAs("SmartArt.pptx", documentStream.ToArray());       
    }
}